package com.fengke.cn.yejian11.base;

import android.content.Context;
import android.content.SharedPreferences;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class BaseActivity extends AppCompatActivity {
    private static SharedPreferences sharedPreferences;
    private  Context context;
    private String Uid;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        init();

    }

    private void init() {
        context=BaseActivity.this;
    }
    public String  getUserId()
    {
        sharedPreferences=getSharedPreferences("kekek", Context.MODE_PRIVATE);
        String Uid = sharedPreferences.getString("uid", null);
        return Uid;
    }
    public void saveUserId(String id)
        {
            sharedPreferences=getSharedPreferences("kekek", Context.MODE_PRIVATE);
            SharedPreferences.Editor editor=sharedPreferences.edit();
            editor.putString("uid",id);
            editor.commit();
        }
    public static boolean  checkName(String telephone)
    {
        String regexp="1(3[0-9]|47|5((?!4)[0-9])|7(0|1|[6-8])|8[0-9])\\d{8,8}";
        Pattern p= Pattern.compile(regexp);
        Matcher matcher=p.matcher(telephone);
        return matcher.matches();
    }
}
